package com.dandandog.framework.faces.scope;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * @Author: JohnnyLiu
 * @Date: 2021/11/17 15:08
 */
public abstract class AbstractScope implements Map<String, Object>, Serializable {

    @Override
    public void clear() {
        getSource().clear();
    }

    @Override
    public boolean containsKey(Object key) {
        return getSource().containsKey(key);
    }

    @Override
    public boolean containsValue(Object value) {
        return getSource().containsValue(value);
    }

    @Override
    public Set<Entry<String, Object>> entrySet() {
        return getSource().entrySet();
    }

    @Override
    public Object get(Object key) {
        return getSource().get(key);
    }

    @Override
    public boolean isEmpty() {
        return getSource().isEmpty();
    }

    @Override
    public Set<String> keySet() {
        return getSource().keySet();
    }

    @Override
    public Object put(String key, Object value) {
        return getSource().put(key, value);
    }

    @Override
    public void putAll(@NotNull Map<? extends String, ?> m) {
        getSource().putAll(m);
    }

    @Override
    public Object remove(Object key) {
        return getSource().remove(key);
    }

    @Override
    public int size() {
        return getSource().size();
    }

    @Override
    public Collection<Object> values() {
        return getSource().values();
    }

    protected abstract Map<String, Object> getSource();
}
